//
//  LGOutPatientRecordHeader.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/3/20.
//

#import "LGPatientIORecordHeader.h"

@interface LGPatientIORecordHeader()
/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UIView *bottomView;
/**   */
@property (nonatomic , strong)UILabel *outTitle;
/**   */
@property (nonatomic , strong)UILabel *outLabel;
/**   */
@property (nonatomic , strong)UILabel *inTitle;
/**   */
@property (nonatomic , strong)UILabel *inLabel;
@end

@implementation LGPatientIORecordHeader

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    _dataDic = dataDic;
    NSString *outContent = LGNSString(dataDic[@"out_content"]);
    NSString *inContent = LGNSString(dataDic[@"in_content"]);
    self.outLabel.text = outContent.length>0?outContent:@" ";
    self.inLabel.text = inContent.length>0?inContent:@" ";
}

-(void)createSubView{
    self.clipsToBounds = YES;
    self.backgroundColor = [UIColor clearColor];
    [self addSubview:self.baseView];
    [self.baseView addSubview:self.monthLabel];
    [self.baseView addSubview:self.bottomView];
    [self.bottomView addSubview:self.outTitle];
    [self.bottomView addSubview:self.outLabel];
    [self.bottomView addSubview:self.inTitle];
    [self.bottomView addSubview:self.inLabel];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(viewPix(5));
        make.left.bottom.equalTo(self).offset(viewPix(16));
        make.right.equalTo(self).offset(-viewPix(16));
    }];
    [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.baseView).offset(viewPix(38));
        make.left.bottom.right.equalTo(self.baseView);
    }];
    [self.outTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bottomView).offset(viewPix(8));
        make.left.equalTo(self.bottomView).offset(viewPix(16));
    }];
    
    [self.outLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.outTitle.mas_right).offset(viewPix(34));
        make.width.equalTo(@(Screen_W-viewPix(116)));
        make.top.equalTo(self.outTitle);
    }];
    
    [self.inTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.outLabel.mas_bottom).offset(viewPix(16));
        make.left.equalTo(self.outTitle);
    }];
    [self.inLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.inTitle);
        make.left.right.equalTo(self.outLabel);
    }];
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B2BDC7" offset:CGSizeMake(0, 2) opacity:0.15 radius:8];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UILabel *)monthLabel{
    if(!_monthLabel){
        _monthLabel = [UILabel lableWithText:@"" colorString:@"#666666" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:1];
        _monthLabel.frame = CGRectMake(viewPix(12), viewPix(10), viewPix(150), viewPix(22));
    }
    return _monthLabel;
}

-(UIView *)bottomView{
    if(!_bottomView){
        _bottomView = [[UIView alloc] init];
        _bottomView.backgroundColor = [UIColor colorWithString:@"#EAF4FF" alpha:0.5];
    }
    return _bottomView;
}

-(UILabel *)outTitle{
    if(!_outTitle){
        _outTitle = [UILabel lableWithText:@"出量" colorString:@"#333333" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _outTitle;
}

-(UILabel *)outLabel{
    if(!_outLabel){
        _outLabel = [UILabel lableWithText:@"" colorString:@"#666666" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _outLabel;
}

-(UILabel *)inTitle{
    if(!_inTitle){
        _inTitle = [UILabel lableWithText:@"入量" colorString:@"#333333" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _inTitle;
}

-(UILabel *)inLabel{
    if(!_inLabel){
        _inLabel = [UILabel lableWithText:@"" colorString:@"#666666" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _inLabel;
}


@end
